<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;

$this->title = Yii::t('app', 'car Brands');
$this->params['breadcrumbs'][] = $this->title;
?>
<p>
    <a href="<?php echo Url::to(['car-info', 'id' => $model_id, 'brand_id' => $brand_id, 'title' => $title]); ?>" class="btn btn-danger">返回上一级</a>
</p>
<style>
    th{background:#CAE1FF}
    .text{
        text-align:center;
    }
    .data-img{
        border:3px solid #ECF0F5;
        width: 18%;
        -webkit-border-radius: 10px;
        border-radius: 10px;
    }
</style>
<h1><?= Html::encode($title) ?></h1>
<p>
    <a href="<?php echo Url::to(['car-image-add', 'car_id' => $car_id, 'brand_id' => $brand_id, 'model_id' => $model_id,  'title' => $title]); ?>" class="btn btn-success">
        上传图片
    </a>
</p>
<br>
<table  class="table table-striped table-bordered">
    <tr>
        <th>展示图</th>
    </tr>
    <tr>
        <td class="text">
            <?php foreach ($data as $value): ?>
                <?php if (!empty($value->type == 1)): ?>
                        <img class="data-img" src="<?php echo $value->image ?>">
                        <p>
                        <?php echo $value->title?$value->title:'展示图'; ?>
                            <nav class="cl-effect-8">
                            <a href="<?php echo Url::to(['car-image-edit', 'id' => $value->id, 'car_id' => $car_id, 'brand_id' => $brand_id, 'model_id' => $model_id, 'title' => $title . '-' . $value->title]); ?>">
                                更新
                            </a>
                        </nav>
                        </p>
                <?php else: ?>
                <?php endif; ?>
            <?php endforeach; ?>
        </td>
    </tr>
    <tr>
        <th>故事图</th>
    </tr>
    <tr>
        <td class="text">
            <?php foreach ($data as $value): ?>
                <?php if (!empty($value->type == 3)): ?>
                    <img class="data-img" src="<?php echo $value->image ?>">
                    <p>
                        <?php echo $value->title?$value->title:'故事图'; ?>
                        <nav class="cl-effect-8">
                            <a href="<?php echo Url::to(['car-image-edit', 'id' => $value->id, 'car_id' => $car_id, 'brand_id' => $brand_id, 'model_id' => $model_id, 'title' => $title . '-' . $value->title]); ?>">
                                更新
                            </a>
                        </nav>
                    </p>
                <?php else: ?>
                <?php endif; ?>
            <?php endforeach; ?>
        </td>
    </tr>
    <tr>
        <th>详情图</th>
    </tr>
    <tr>
        <td class="text">
            <?php foreach ($data as $value): ?>
                <?php if (!empty($value->type == 2)): ?>
                        <img class="data-img" src="<?php echo $value->image ?>">
                        <p>
                        <?php echo $value->title?$value->title:'详情图'; ?>
                        <nav class="cl-effect-8">
                            <a href="<?php echo Url::to(['car-image-edit', 'id' => $value->id, 'car_id' => $car_id, 'brand_id' => $brand_id, 'model_id' => $model_id, 'title' => $title . '-' . $value->title]); ?>">
                                更新
                            </a>
                        </nav>
                        </p>
                <?php else: ?>
                <?php endif; ?>
            <?php endforeach; ?>
        </td>
    </tr>
</table>
<?php if (empty($data)): ?>
    <div class="no-result">暂无图片</div>
<?php endif; ?>
